function submitPage(id, form) {
    var pl_number = document.getElementById("pl_number").value;
    var pl_date = document.getElementById("pl_date").value;
    var pl_name = document.getElementById("pl_name").value;
    var pl_age = document.getElementById("pl_age").value;
    var pl_diagnosis = document.getElementById("pl_diagnosis").value;
    var pl_department = document.getElementById("pl_department").value;
    var pl_rp = document.getElementById("pl_rp").value;
    var pl_deployment = document.getElementById("pl_deployment").value;
    var pl_review = document.getElementById("pl_review").value;
    var pl_amount = document.getElementById("pl_amount").value;
    if (pl_number == null || pl_number == "") {
        document.getElementById("error").innerHTML = "门诊/住院病历号不能为空!!!";
        return false;
    }
    if (pl_date == null || pl_date == "") {
        document.getElementById("error").innerHTML = "日期不能为空!!!";
        return false;
    }
    if (pl_name == null || pl_name == "") {
        document.getElementById("error").innerHTML = "姓名不能为空!!!";
        return false;
    }
    if (pl_age == null || pl_age == "") {
        document.getElementById("error").innerHTML = "年龄不能为空!!!";
        return false;
    }
    if (pl_diagnosis == null || pl_diagnosis == "") {
        document.getElementById("error").innerHTML = "临床诊断不能为空!!!";
        return false;
    }
    if (pl_department == null || pl_department == "") {
        document.getElementById("error").innerHTML = "科别(病室及床号)不能为空!!!";
        return false;
    }
    if (pl_rp == null || pl_rp == "") {
        document.getElementById("error").innerHTML = "Rp不能为空!!!";
        return false;
    }
    if (pl_deployment == null || pl_deployment == "") {
        document.getElementById("error").innerHTML = "调配不能为空!!!";
        return false;
    }
    if (pl_review == null || pl_review == "") {
        document.getElementById("error").innerHTML = "复核不能为空!!!";
        return false;
    }
    if (pl_amount == null || pl_amount == "") {
        document.getElementById("error").innerHTML = "药品金额不能为空!!!";
        return false;
    }
    if (id != 0) {
        form.action = "addMR.action?action=modify&id=" + id;
    }
    return true;
}
function printPage() {
    var pl_number = document.getElementById("pl_number").value;
    var pl_date = document.getElementById("pl_date").value;
    var pl_name = document.getElementById("pl_name").value;
    var sex_check = document.getElementsByName("pl_sex");
    var pl_sex = " ";
    for (let i = 0; i < sex_check.length; i++) {
        if (sex_check[i].checked) {
            pl_sex = sex_check[i].value;
        }
    }
    var pl_age = document.getElementById("pl_age").value;
    var expensetype_check = document.getElementsByName("pl_expensetype");
    var pl_expensetype = " ";
    for (let i = 0; i < expensetype_check.length; i++) {
        if (expensetype_check[i].checked) {
            pl_expensetype = expensetype_check[i].value;
        }
    }
    var pl_diagnosis = document.getElementById("pl_diagnosis").value;
    var pl_department = document.getElementById("pl_department").value;
    var pl_rp = document.getElementById("pl_rp").value;
    var pl_deployment = document.getElementById("pl_deployment").value;
    var pl_review = document.getElementById("pl_review").value;
    var pl_amount = document.getElementById("pl_amount").value;
    if (pl_number == null || pl_number == "") {
        document.getElementById("error").innerHTML = "门诊/住院病历号不能为空!!!";
        return false;
    }
    if (pl_date == null || pl_date == "") {
        document.getElementById("error").innerHTML = "日期不能为空!!!";
        return false;
    }
    if (pl_name == null || pl_name == "") {
        document.getElementById("error").innerHTML = "姓名不能为空!!!";
        return false;
    }
    if (pl_age == null || pl_age == "") {
        document.getElementById("error").innerHTML = "年龄不能为空!!!";
        return false;
    }
    if (pl_diagnosis == null || pl_diagnosis == "") {
        document.getElementById("error").innerHTML = "临床诊断不能为空!!!";
        return false;
    }
    if (pl_department == null || pl_department == "") {
        document.getElementById("error").innerHTML = "科别(病室及床号)不能为空!!!";
        return false;
    }
    if (pl_rp == null || pl_rp == "") {
        document.getElementById("error").innerHTML = "Rp不能为空!!!";
        return false;
    }
    if (pl_deployment == null || pl_deployment == "") {
        document.getElementById("error").innerHTML = "调配不能为空!!!";
        return false;
    }
    if (pl_review == null || pl_review == "") {
        document.getElementById("error").innerHTML = "复核不能为空!!!";
        return false;
    }
    if (pl_amount == null || pl_amount == "") {
        document.getElementById("error").innerHTML = "药品金额不能为空!!!";
        return false;
    }
    window.localStorage.setItem('number', pl_number);
    window.localStorage.setItem('date', pl_date);
    window.localStorage.setItem('name', pl_name);
    window.localStorage.setItem('sex', pl_sex);
    window.localStorage.setItem('age', pl_age);
    window.localStorage.setItem('expensetype', pl_expensetype);
    window.localStorage.setItem('diagnosis', pl_diagnosis);
    window.localStorage.setItem('department', pl_department);
    window.localStorage.setItem('rp', pl_rp);
    window.localStorage.setItem('deployment', pl_deployment);
    window.localStorage.setItem('review', pl_review);
    window.localStorage.setItem('amount', pl_amount);
    window.location.href = "print.action";
}
